package exercise;

import java.time.Clock;
import java.time.Duration;
import java.time.Instant;
import java.time.temporal.ChronoUnit;

/**
 * @classname:InstantDemo
 * @description:
 * @author: Mr.Z
 * @date: 2020/12/10 17:10
 * @version: 0.1
 * @since:1.8
 */
public class InstantDemo {
    public static void main(String[] args) {
        Instant now = Instant.now();
        System.out.println(now);
//        Instant instant = now.plusSeconds(8 * 1000 * 3600);
//        System.out.println(instant);
        Instant plus = now.plus(Duration.ofHours(8));
        Instant plus1 = now.plus(5, ChronoUnit.HOURS);
        System.out.println(plus);
        System.out.println(plus1);
        Instant now1 = Instant.now(Clock.offset(Clock.systemUTC(), Duration.ofHours(8)));
        long until = plus.until(plus1, ChronoUnit.HOURS);
        System.out.println(until);

    }
}
